<?php
/* @var $this DefaultController */

$this->breadcrumbs=array(
	$this->module->id,
);


?>
<ul>
	<li>View file: <code><?php echo __FILE__; ?></code></li>
	<li>Layout file: <code><?php echo $this->getLayoutFile('main'); ?></code></li>
</ul>

<?php

// $aa = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.js'));
// Yii::app()->clientScript->registerScriptFile(
// 		$aa . '/app.js',
// 		CClientScript::POS_END
// );
// Yii::app()->clientScript->registerCssFile($aa . '/resources/zzz-all.css');

//# from config
Yii::app()->clientScript->registerPackage('extjs');
?>

<script type="text/javascript">

Ext.onReady(function() {

	Ext.define('modelPhone', {
		extend: 'Ext.data.Model',
		fields:['name', 'phone']
	});

	var store = Ext.create('Ext.data.JsonStore', {
		model: modelPhone,
		autoLoad: true,
		proxy: {
			type: 'ajax',
			url: '<?= $this->createUrl('', array('ajax' => 1)); ?>',
			method: 'GET',
			reader: {
				root: 'data',
			}
		}
	});

	Ext.create('Ext.grid.Panel', {
	    id: 'g1',
	    store: store,
	    renderTo: 'cont_grid',
	    columns: [
	        { text: 'Name',  dataIndex: 'name', flex: 1},
	        { text: 'Phone', dataIndex: 'phone' }
	    ],
	    height: 200,
	    width: 300,
	});

});

</script>

<div id="cont_grid"></div>
<br />
<?php
	echo CHtml::link('go to m1.SubController (action = gera)', $this->createUrl('sub/gera'));
?>

